package com.hdax.dm.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hdax.dm.beans.base.area;
import com.hdax.dm.dto.areaDto;
import com.hdax.dm.mappers.areaMapper;
import com.hdax.dm.mapstucts.areaDtoMapper;
import com.hdax.dm.service.areaService;
import com.hdax.dm.utils.response.CommonResponse;
import com.hdax.dm.utils.response.ResponseUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class areaServiceImpl extends ServiceImpl<areaMapper, area> implements areaService {

    @Autowired
    private areaDtoMapper areaDtoMapper;

    @Override
    public CommonResponse<List<areaDto>> querycity() {
        QueryWrapper queryWrapper = new QueryWrapper();
        queryWrapper.eq("isHot",1);
        List<area> lists = baseMapper.selectList(queryWrapper);
        List<areaDto> dtos = areaDtoMapper.toTargetList(lists);
        return ResponseUtil.returnSuccess(dtos);
    }
}
